﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using HGZP.PLL;

namespace HGZP.DAL
{
    /// <summary>
    /// 功能：对用户操作自定义DAL类
    /// 创建人：商伟
    /// 创建时间：2011-6-13
    /// </summary>
    public class BaseUserCollection
    {
        /// <summary>
        /// 获取表中所有的列和行
        /// </summary>
        /// <returns></returns>
        public DataTable GetUserFuction(string userGuid)
        {
            string sSqlString = @" 
                 select sGuid,sCaption,sFeaturesURL,sParentGuid,bMain from infomenu  
                 where  exists(select  'x' from basepurview as b inner join baserole as a on b.sguidbaserole=a.sguid 
                        where infomenu.sguid= b.sguidinfomenu and exists(select 'x' from baseuserrole 
                              where sguidbaserole =a.sguid and sguidbaseuser='" + userGuid + "' )) ORDER BY iSort DESC";
            SqlHelp mySqlHelp = new SqlHelp();
            DataSet A_DataSet = mySqlHelp.SelectDataBySql(sSqlString);
            if (A_DataSet == null) { throw new Exception(SqlHelp.globalErrorString); }
            A_DataSet.Tables[0].TableName = "userFunction";
            return A_DataSet.Tables[0];
        }
    }
}
